﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Data;

namespace LosConn.Web.Money
{
    public partial class MoneyRetailListSupDetail : BasePage.AdminBasePage
    {
        public String orderDetailHtml = String.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                GetOrderDetailHtml(Convert.ToInt32(Request["id"]));
            }
        }

        /// <summary>
        /// 获取订单详细列表
        /// </summary>
        /// <param name="Guest_ID"></param>
        private void GetOrderDetailHtml(Int32 Order_ID)
        {
            BLL.Los_Order bll = new BLL.Los_Order();
            StringBuilder sb = new StringBuilder(5000);
            DataTable dt = bll.GetOrderProductDetailList(String.Format("OrderProduct_OrderID={0}", Order_ID)).Tables[0];
            Decimal Money = 0;
            //Order_Money = dt.Rows[0]["Order_Money"].ToString();
            if (dt != null && dt.Rows.Count > 0)
            {
                sb.AppendFormat("<h4 class=\"text-success\">{0}</h4>", "辅助品");
                Money = 0;
                sb.Append("<table class=\"table table-bordered table-condensed table-hover\">");
                sb.Append("<thead>");
                sb.Append("<tr><th>产品编码</th><th>产品名称</th><th>产品价格</th><th>数量</th><th>总金额</th></tr>");
                sb.Append("</thead>");
                sb.Append("<tbody>");
                foreach (DataRow dr in dt.Rows)
                {
                    Money += Convert.ToDecimal(dr["OrderProduct_Money"]);
                    sb.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td></tr>", dr["Product_Code"], dr["Product_Name"], dr["Product_Price"], dr["OrderProduct_Number"], dr["OrderProduct_Money"]);
                }
                sb.Append("</tbody>");
                sb.Append("<tfoot>");
                sb.Append("<tr><th class=\"total-label\" colspan=\"4\" style=\"text-align: right;\">小计</th><th class=\"total-amount\">￥： <strong class=\"text-error\">" + Money + "</strong></th></tr>");
                sb.Append("</tfoot>");
                sb.Append("</table>");

                //sb.Append("<h4 class=\"text-success\">测试</h4>");

            }
            orderDetailHtml = sb.ToString();
        }
    }
}